package com.joysuch.wwyt.bp.entity.contractor;

import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.joysuch.wwyt.core.bean.BaseAttachmentBean;
import com.joysuch.wwyt.core.support.AutoSetCommonFieldListener;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.SQLDeleteAll;
import org.hibernate.annotations.Where;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.time.LocalDate;
import java.util.Date;
import java.util.List;

import static javax.persistence.GenerationType.IDENTITY;

/**
 * 承包商施工管理
 *
 * @author sumeiqi
 * 2021-01-12
 */
@EntityListeners({AuditingEntityListener.class, AutoSetCommonFieldListener.class})
@Entity
@Table(name = "wwyt_bp_contractor_violation_records_management")
@SQLDelete(sql = "update wwyt_bp_contractor_violation_records_management set DELETE_FLAG = '1' where id= ?")
@SQLDeleteAll(sql = "update wwyt_bp_contractor_violation_records_management set DELETE_FLAG = '1' where id= ?")
@Where(clause = "DELETE_FLAG = '0'")
@Data
@TableName(value = "wwyt_bp_contractor_violation_records_management")
public class BpContractorViolationRecord {
    @Id
    @GeneratedValue(strategy = IDENTITY)
    private Long id;
    @ApiModelProperty("承包商违章记录管理编码")
    private String code;
    @ApiModelProperty("承包商表Id")
    private Long contractorId;
    @ApiModelProperty("项目名称")
    private String projectName;
    @ApiModelProperty("违章日期")
    private LocalDate violatorDate;
    @ApiModelProperty("处理结果")
    private String processingResults;
    @ApiModelProperty("违章人姓名")
    private String violatorName;

    @ApiModelProperty("违章类型")
    private Integer violationType;
    @ApiModelProperty("处罚金额")
    private String penaltyAmount;
    @ApiModelProperty("处罚积分")
    private String penaltyIntegral;
    @ApiModelProperty("附件")
    private String attachment;

    private transient String contractorName;
    private transient Integer violationCount;//次数
    private transient Double violationAmount;
    private transient Double violationIntegral;
    private transient String violationDetail;
    private transient Date beginTime;
    private transient Date endTime;


    //通用字段
    @ApiModelProperty("数据状态字段: 0 无效; 1 有效")
    private Integer state;
    @ApiModelProperty("创建人")
    @org.springframework.data.annotation.CreatedBy
    @JsonIgnore
    private Long createBy;
    @ApiModelProperty("创建时间")
    @org.springframework.data.annotation.CreatedDate
    @JsonIgnore
    private java.time.LocalDateTime createTime;
    @ApiModelProperty("更新人")
    @org.springframework.data.annotation.LastModifiedBy
    @JsonIgnore
    private Long updateBy;
    @ApiModelProperty("更新时间")
    @org.springframework.data.annotation.LastModifiedDate
    @JsonIgnore
    private java.time.LocalDateTime updateTime;
    @ApiModelProperty("租户")
    @JsonIgnore
    private Long tenentId;
    @ApiModelProperty("组织机构代码")
    @JsonIgnore
    private String orgCode;
    @ApiModelProperty("删除标记")
    @JsonIgnore
    private String deleteFlag;
}
